import { ref, computed } from 'vue'
import { defineStore } from 'pinia'

export const tokenStore = defineStore('token', () => {
  const token = ref(null)
  const getToken = computed(() => token.value)
  function setToken(value) {
    token.value = value
  }

  return { token, getToken, setToken }
}, {
  persist: {
    key: 'piniaStore', //存储名称
    storage: sessionStorage, // 存储方式
  }
})
